Writing Testsuites

[ Start > PikeDevel > Writing Testsuites ] [ Edit this Page | Viewing Version 5 ]


test_any

Usage:

test_any([[a]], b)

parameter a: a block of code (classes and functions) that return a value

parameter b: a value or expression

does the return value of the block "a" equal the value b, as in ==?

Example:

test_any([[
  int f (int i) {i = 0; return i;};
  return f (1);
]],0)

test_any_equal

Usage:

test_any_equal([[a]], b)

parameter a: a block of code (classes and functions) that return a value

parameter b: a value or expression

does the return value of the block "a" equal the value b, as in equal()? useful for checking reference types when you want to check for the sameness of values

Example:

test_any_equal([[
  class Foo {int foo();};
  return indices(Foo());
]], ({"foo"}))

test_eq

Usage:

test_eq(a, b)

parameter a: a value or expression

parameter b: a value or expression

are a and b the same item, as in ==?

Example:

test_eq('u117f', 0x117f)

test_equal

Usage:

test_equal(a, b)

parameter a: a value or expression

parameter b: a value or expression

are a and b equal, as in equal()? useful for checking reference types when you want to check for the sameness of values

Example:

test_equal(mtest_m,copy_value(mtest_m))

test_do

Usage:

test_do(a)

parameter a: a function body

does a run?

Example:

test_do([[
  void foo (int i) {
    multiset res = (<>);
    if (i) res = res;
  };
  foo (1);
]])

test_true

Usage:

test_true(a)

parameter a: a value or expression

does a evaluate to true (ie not integer zero (0) )

Example:

test_true("A" == upper_case("a"))

test_false

Usage:

test_false(a)

parameter a: a value or expression

does a evaluate to false (ie an integer zero (0))

Example:

test_false("A" == "a")

test_compile

Usage:

test_compile([[a]])

parameter a: one or more statements to compile, these statements will be placed inside a function body.

does the code compile?

Example:

test_compile([[ Stdio.File foo=Stdio.File(); ]])

test_compile_any

Usage:

test_compile_any([[a]])

parameter a: a code block (functions and classes) to compile

does the code compile?

Example:

test_compile_any([[
  void foo()
  {
    Stdio.File bar(int x, int y)
    {
      return 0;
    };
  }
]])

test_compile_error

Usage:

test_compile_error([[a]])

parameter a: one or more statements to compile (these statements will be placed inside a function body).

does the code fail to compile?

Example:

test_compile_error([[ string a="x"; int b; b="x"*17; ]])

test_compile_error_any

Usage:

test_compile_error_any([[a]])

parameter a: a code block (functions and classes) to compile

does the code fail to compile?

Example:

test_compile_error_any([[
 mixed foo;
 mapping query_variables() { return ([]); };
 mixed foo(mixed bar) { return 1/foo; }
]])

test_compile_warning

Usage:

test_compile_warning

Example:

test_compile_warning_any

Usage:

test_compile_warning_any

Example:

test_eval_error

Usage:

test_eval_error

Example:

other testsuite functions:

test_define_program,[[DOTEST(RUN,dnl test_program, [[DOTEST(TRUE,dnl test_program_eq, [[DOTEST(EQ,dnl test_program_equal, [[DOTEST(EQUAL,dnl test_tests, [[DOTEST(RUNCT,dnl cond,dnl [[CONDITION]],[[COND &#36;1 [[CONDITION]],[[]]) cond_resolv,[[cond([[master()->resolv(dnl ifefun,[[cond([[all_constants()->&#36;1]],[[&#36;2]])]]) nonregression,[[ifefun(regression,[[&#36;1]])]]) TESTNO,0) [[test_cmp]],[[ [[test_cmp3]],[[


Powered by PikeWiki2

 
gotpike.org | Copyright © 2004 - 2009 | Pike is a trademark of Department of Computer and Information Science, Linköping University